import os

from classpath.entry import Entry
from classpath.composite_entry import CompositeEntry
from classpath.zip_entry import ZipEntry


class WildcardEntry(Entry):
    @staticmethod
    def newWildcardEntry(path):
        compositeEntry = CompositeEntry([])
        parentDir = os.path.dirname(path)
        for file in os.listdir(parentDir):
            if file.endswith("jar") or file.endswith("JAR"):
                compositeEntry.entries.append(ZipEntry.newZipEntry(os.path.join(parentDir, file)))
        return compositeEntry


if __name__ == '__main__':
    print(os.path.dirname("C:\\*"))

